<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品展示</title>
    <link href="/static/css/table.css" type="text/css" rel="stylesheet">
</head>
<body>
<p style="color: red;font-size: 24px;text-align: center">{{ get_flashed_messages()[0] }}</p>
<p style="color: red;font-size: 24px;text-align: center">{{ get_flashed_messages()[1] }}</p>
<p style="color: red;font-size: 24px;text-align: center">{{ get_flashed_messages()[2] }}</p>
<p style="color: red;font-size: 24px;text-align: center">{{ get_flashed_messages()[3] }}</p>
<form>
    <table class="table">
        <tr class="tr">
            <th colspan="8" style="font-size: 36px" class="th">商品列表</th>
        </tr>
        <tr class="tr">
            <th width="8%" class="th">商品序号</th>
            <th width="20%" class="th">商品名称</th>
            <th class="th">商品价格</th>
            <th class="th">商品分类</th>
            <th width="20%" class="th">商品详情</th>
            <th class="th">商品图片</th>
            <th class="th">选择修改</th>
            <th class="th">选择删除</th>
        </tr>
        {% for foo in pag.items %}
            <tr class="tr">
                <td class="td">{{ per_page*(page_num-1)+loop.index }}</td>
                <td class="td">{{ foo.name }}</td>
                <td class="td">{{ foo.price }}</td>
                <td class="td">{{ foo.cate.name }}</td>
                <td class="td"><a href="/parti/{{ foo.id }}">{{ foo.name }}&nbsp;&nbsp;详情页</a></td>
                <td class="td"><img src="{{ foo.photo }}" style="width: 50px"></td>
                <td class="td"><a href="/updategoods/{{ foo.id }}">修改</a></td>
                <td class="td"><a href="/deletegoods/{{ foo.id }}">删除</a></td>
            </tr>
        {% endfor %}

        <tr class="tr">
            <td colspan="8" class="td">
                <a href="/goodslist?page_num={{ pev_page }}">上一页</a>
                {% for foo in pag.iter_pages() %}
                    <a href="/goodslist?page_num={{ foo }}">{{ foo }}</a>
                {% endfor %}
                <a href="/goodslist?page_num={{ mext_num }}">下一页</a>
            </td>
        </tr>
        <tr class="tr">
            <td class="td">
                <a href="/addgoods"><input type="button" class="button" value="添加商品"></a>
            </td>
        </tr>
    </table>
</form>
</body>
</html>